Skip to content

feat: require strong passwords#8828

Merged
rjsparks merged 33 commits intoietf-tools:mainfrom
jennifer-richards:password-strength
Jun 24, 2025
Merged

feat: require strong passwords#8828
rjsparks merged 33 commits intoietf-tools:mainfrom
jennifer-richards:password-strength

Conversation

@jennifer-richards
Copy link
Copy Markdown
Member

@jennifer-richards jennifer-richards commented Apr 23, 2025

Adds a password validator based on zxcvbn-python. Rejects passwords with strength < 3. Also rejects passwords shorter than 12 characters.

Refactors change-password and login forms to use more of Django's password validation methods.

For the login view, validation failure causes the user to be instructed to reset their password.

For the password change view, validation failure rejects the attempt to update the password. The JS is updated to do the same validation on the client side to prevent submission of the form so the user can correct mistakes before submitting and losing their form state.

image

@jennifer-richards jennifer-richards removed the request for review from rjsparks June 11, 2025 13:04
@jennifer-richards jennifer-richards marked this pull request as ready for review June 11, 2025 20:18
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 18, 2025

Codecov Report

Attention: Patch coverage is 84.09091% with 7 lines in your changes missing coverage. Please review.

Project coverage is 88.69%. Comparing base (18cea10) to head (3898f4d).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
ietf/ietfauth/views.py 50.00% 4 Missing ⚠️
ietf/ietfauth/password_validation.py 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8828      +/-   ##
==========================================
- Coverage   88.71%   88.69%   -0.03%     
==========================================
  Files         320      321       +1     
  Lines       41793    41820      +27     
==========================================
+ Hits        37078    37093      +15     
- Misses       4715     4727      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jennifer-richards jennifer-richards changed the title feat: enforce pw strength at login feat: enforce pw strength/max last-login age Jun 18, 2025
@jennifer-richards jennifer-richards marked this pull request as draft June 18, 2025 16:14
@jennifer-richards jennifer-richards changed the title feat: enforce pw strength/max last-login age feat: require strong passwords Jun 18, 2025
@jennifer-richards
Copy link
Copy Markdown
Member Author

Removed the attempt at requiring stale accounts to reset their passwords. We don't store a password age so there's no clean mechanism for indicating that a user has gone through the password reset. We can revisit that separately.

@jennifer-richards jennifer-richards marked this pull request as ready for review June 18, 2025 17:29
@richsalz
Copy link
Copy Markdown
Collaborator

We don't store a "last-login" in the user record? Perhaps we should.

@jennifer-richards
Copy link
Copy Markdown
Member Author

We don't store a "last-login" in the user record? Perhaps we should.

We do; the reverted commits used that to decide whether to let someone log in or not. The problem is that after they reset their password, they still haven't logged in, so they're again prompted to reset their password.

What's missing is a way to flag "hasn't logged in but already updated their password." It's a tractable problem, but bigger than would be reasonable to toss in to this PR.

@richsalz
Copy link
Copy Markdown
Collaborator

That makes sense, thanks for the explanation.

rjsparks
rjsparks previously approved these changes Jun 18, 2025
@rjsparks rjsparks merged commit 9e4660e into ietf-tools:main Jun 24, 2025
10 checks passed
@jennifer-richards jennifer-richards deleted the password-strength branch June 24, 2025 17:57
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants